package com.huijinhui.wlmtsys.controller;


import com.huijinhui.wlmtsys.pojo.dtos.LeaveApplicationDTO;
import com.huijinhui.wlmtsys.pojo.vo.LeaveApplicationVO;
import com.huijinhui.wlmtsys.service.LeaveApplicationService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/leave")
@RequiredArgsConstructor
@Tag(name = "不要写：请假申请控制器", description = "处理所有与请假申请相关的操作")
public class LeaveApplicationController {

    @Autowired
    private LeaveApplicationService leaveApplicationService;

    @PostMapping
//    @Operation(summary = "提交请假申请")
    public LeaveApplicationVO createLeaveApplication(@RequestBody LeaveApplicationDTO leaveApplicationDTO) {
        return leaveApplicationService.createLeaveApplication(leaveApplicationDTO);
    }

    @GetMapping("/user/{userId}")
//    @Operation(summary = "获取用户的请假记录")
    public List<LeaveApplicationVO> getUserLeaveApplications(@PathVariable Long userId) {
        return leaveApplicationService.getUserLeaveApplications(userId);
    }
}